//
//  MPViewController.m
//  MPBPlayer
//
//  Created by 13241143266@163.com on 12/13/2017.
//  Copyright (c) 2017 13241143266@163.com. All rights reserved.
//

#import "MPViewController.h"
#import "Masonry.h"
#import "CommonVideoPlayerView.h"
#import "MPVPVideoPlayerModel.h"

@interface MPViewController ()

@property(nonatomic,strong) UIView * playViewSuperView;

@end

@implementation MPViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    
    //播放器的父视图
    self.playViewSuperView = [[UIView alloc]init];
    [self.view addSubview:self.playViewSuperView];
    //设置播放器父视图的frame
    [self.playViewSuperView mas_makeConstraints:^(MASConstraintMaker *make)
     {
         make.top.equalTo(self.view.mas_top).mas_offset(64);
         make.left.equalTo(self.view.mas_left);
         make.height.mas_equalTo(211);
         make.width.mas_equalTo(self.view.frame.size.width);
     }];
    
    //初始化播放器
   CommonVideoPlayerView * playView = [[CommonVideoPlayerView alloc] init];
    //将播放器添加到的父视图上
   [playView addFeedPlayerViewToTargetView:self.playViewSuperView];
    
    //设置播放器的model信息
    MPVPVideoPlayerModel * videoPlayerModel = [[MPVPVideoPlayerModel alloc]init];
    videoPlayerModel.videoUrlString = @"http://flv3.bn.netease.com/videolib3/1712/15/kwaAK3596/SD/kwaAK3596-mobile.mp4";
    //开始播放视频
    [playView setPlayReloadWithStyle:MPE_DirectGetUrl playModel:videoPlayerModel];
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
